package ink.lovejinhu.leetcode;

/**
 * @author jinhu
 * created 2021-07-31 17:30
 */
public class Solution_0657 {
    /**
     * @param moves
     * @return
     */
    public boolean judgeCircle(String moves) {
        Robot robot = new Robot();
        for (int i = 0; i < moves.length(); i++) {
            if (moves.charAt(i) == 'L') {
                robot.left++;
            } else if (moves.charAt(i) == 'R') {
                robot.right++;
            } else if (moves.charAt(i) == 'U') {
                robot.upper++;
            } else {
                robot.d++;

            }
        }
        return robot.left == robot.right && robot.d == robot.upper;
    }

    class Robot {
        public int left;
        public int right;
        public int upper;
        public int d;

    }
}
